<?php

namespace app\api\sxc;

use app\api\model\SystemLog;
/**
 * API系统事件
 * Class SystemSubscribe
 * @package crmeb\subscribes
 */
class SystemSubscribe
{

    public function handle()
    {

    }

    /**
     * 添加用户访问记录
     * @param $event
     */
    public function onApiVisit($event)
    {
        list($uid, $name) = $event;
        SystemLog::adminVisit($uid,$name);
    }

    /**
     * 添加管理员最后登录时间和ip
     * @param $event
     */
    public function onSystemAdminLoginAfter($event)
    {
        list($adminInfo) = $event;
        SystemAdmin::edit(['last_ip' => app('request')->ip(), 'last_time' => time()], $adminInfo['id']);
    }

    /**
     * 商户注册成功之后
     * @param $event
     */
    public function onMerchantRegisterAfter($event)
    {
        list($merchantInfo) = $event;
    }

}